package com.igirl.manage.service.item;

import com.github.abel533.entity.Example;
import com.github.abel533.mapper.Mapper;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.igirl.manage.mapper.item.ItemMapper;
import com.igirl.manage.pojo.Item;
import com.igirl.manage.pojo.ItemDesc;
import com.igirl.manage.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: jiaheng
 * @Description:
 * @Date: Created in 21:19 2017/12/25
 * @Modified:
 */
@Service
public class ItemService extends BaseService<Item>{

    @Autowired
    private ItemDescService itemDescService;

    @SuppressWarnings("SpringJavaAutowiringInspection")
    @Autowired
    private ItemMapper itemMapper;


    public List<Item> queryAll(String order,Integer page, Integer rows) {
        PageHelper.startPage(page, rows);
        Example example = new Example(Item.class);
        example.setOrderByClause(order);
        List<Item> itemList = this.itemMapper.selectByExample(example);
        return itemList;
    }


    public void saveItemDesc(ItemDesc itemDesc) {
        this.itemDescService.saveSelective(itemDesc);
    }

    public void updateItemDesc(ItemDesc itemDesc) {
        this.itemDescService.updateSelective(itemDesc);
    }
}
